<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Title</title>
	<link rel="stylesheet" href="">
</head>
<script src=""></script>
<body>
<img src="https://img12.360buyimg.com/seckillcms/s140x140_jfs/t1/57827/25/24110/39049/64743e93F813d6aee/d2d6cae85d5780a4.jpg.avif" alt="">
</body>
<script>
	// ajax的BUG解决流程：
	// 1- 检查请求的服务是否存在。
	// 2- 是否跨域
	// 3- 检查请求方式，请求地址，参数
	{
		// get
		const xhr = new XMLHttpRequest();
		xhr.responseType = "json";
		xhr.open("get","/info?a=1");
		xhr.send();
		xhr.onload = function(){
			console.log(xhr.response);
		}
	}
	{
		const xhr = new XMLHttpRequest();
		xhr.open("post","/info");
		xhr.setRequestHeader("Content-Type","application/json");
		xhr.send(JSON.stringify({
			a:1,
			b:2
		}));
		xhr.onreadystatechange = function(){
			if(xhr.readyState === 4 && xhr.status === 200){
				console.log(xhr.response);
			}
		}
	}
</script>
</html>